'use strict'

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app
  router.get('/', controller.home.index)

  // 用户
  router.post('/user/login', controller.user.login)
  router.get('/user/auto-login', controller.user.autoLogin)
  router.post('/user/logout', controller.user.logout)
  router.get('/users', controller.user.list)

  router.get('/user/info', controller.user.detail)
  router.post('/user/sign-up', controller.user.create)
  router.put('/user/update', controller.user.update)
  router.put('/user/update-password', controller.user.updatePassword)

  // 项目
  router.resources('projects', '/projects', controller.project)
  // 任务
  router.resources('todos', '/todos', controller.todo)

  // 文件
  router.post('/files/upload', controller.files.upload)
  router.get('/files/download', controller.files.download)

  // bing壁纸接口
  router.get('/bing', controller.bing.index)
}
